﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Business;




namespace ServicesDirectory.UserControl
{
    public partial class OrganisationDetail2 : System.Web.UI.UserControl
    {
        public int Specialism ;
        public int ServicePersonalCircumstances ;
        public int ServiceDisability ;
        public int ServiceEthnicity ;
        public int ServiceBarriers ;
        public int Accreditation ;
        public int ServiceBenefits ;
        
        public void GetData()
        {
            Specialism = int.Parse(cklSpecialism.SelectedValue);
            ServicePersonalCircumstances = int.Parse(cklPersonal.SelectedValue);
            ServiceDisability = int.Parse(cklDisablities.SelectedValue);
            ServiceEthnicity = int.Parse(cklEthnicity.SelectedValue);
            ServiceBarriers = int.Parse(cklBarriers.SelectedValue);
            Accreditation = int.Parse(cklAccreditation.SelectedValue);
            ServiceBenefits = int.Parse(cklBenefits.SelectedValue);
        }

        public void LoadData()
        {

        }

        protected void Page_Load(object sender, EventArgs e)
        {
            BindOrganisationSpecialisation();
            BindServiceBarriersCapabilities();
            BindServiceBenefitsCapabilities();
            BindServiceDisabilitiesCapabilities();
            BindServiceEthnicityCapabilities();
            BindServicePersonalCircumstanceCapabilities();
            BindAccreditation();
        }

        #region load reference data
        private void BindOrganisationSpecialisation()
        {
            var collSpecialisation = OrganizationBusiness.Instance.GetOrganisationSpecialisation();
            cklSpecialism.DataSource = collSpecialisation;
            cklSpecialism.DataTextField = "DataRef";
            cklSpecialism.DataValueField = "RefValue";
            cklSpecialism.DataBind();
        }

        private void BindServiceDisabilitiesCapabilities()
        {
            var collection = OrganizationBusiness.Instance.GetServiceDisabilitiesCapabilities();
            cklDisablities.DataSource = collection;
            cklDisablities.DataTextField = "DataRef";
            cklDisablities.DataValueField = "RefValue";
            cklDisablities.DataBind();
        }

        private void BindServiceBarriersCapabilities()
        {
            var collection = OrganizationBusiness.Instance.GetServiceBarriersCapabilities();
            cklBarriers.DataSource = collection;
            cklBarriers.DataTextField = "DataRef";
            cklBarriers.DataTextField = "RefValue";
            cklBarriers.DataBind();
        }

        private void BindServiceBenefitsCapabilities()
        {
            cklBenefits.DataSource = OrganizationBusiness.Instance.GetServiceBenefitsCapabilities();
            cklBenefits.DataTextField = "DataRef";
            cklBenefits.DataValueField = "RefValue";
            cklBenefits.DataBind();
        }

        private void BindServicePersonalCircumstanceCapabilities()
        {
            cklPersonal.DataSource = OrganizationBusiness.Instance.GetServicePersonalCircumstanceCapabilities();
            cklPersonal.DataTextField = "DataRef";
            cklPersonal.DataValueField = "RefValue";
            cklPersonal.DataBind();
        }

        private void BindServiceEthnicityCapabilities()
        {
            cklEthnicity.DataSource = OrganizationBusiness.Instance.GetServiceEthnicityCapabilities();
            cklEthnicity.DataTextField = "DataRef";
            cklEthnicity.DataValueField = "RefValue";
            cklEthnicity.DataBind();
        }

        private void BindAccreditation()
        {
            cklAccreditation.DataSource = OrganizationBusiness.Instance.GetAccreditation();
            cklAccreditation.DataTextField = "DataRef";
            cklAccreditation.DataValueField = "RefValue";
            cklAccreditation.DataBind();
        }

        #endregion
    }
}